package com.yxq.mdt.app.modules.video.ui.fragment;


import android.view.View;

import androidx.annotation.Nullable;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.yxq.mdt.app.R;
import com.yxq.mdt.app.base.BaseFragment;
import com.yxq.mdt.app.modules.video.adapter.RecommendAdapter;
import com.yxq.mdt.app.modules.video.bean.AdvertBean;
import com.yxq.mdt.app.modules.video.bean.ChannelListBean;
import com.yxq.mdt.app.modules.video.bean.MLUserList;
import com.yxq.mdt.app.modules.video.bean.MainVideoBean;
import com.yxq.mdt.app.modules.video.bean.RecommendBannerBean;
import com.yxq.mdt.app.modules.video.bean.RecommendBean;
import com.yxq.mdt.app.modules.video.bean.RecommendListBean;
import com.yxq.mdt.app.modules.video.model.MainVideoModel;
import com.yxq.mdt.app.modules.video.presenter.IMainVideoContract;
import com.yxq.mdt.app.modules.video.presenter.MainVideoPresenter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * 附近
 */
public class VideoRecommendFragment extends BaseFragment<MainVideoPresenter> implements IMainVideoContract.View {
    public static final String EXTRA_TEXT = "extra_text";
    @BindView(R.id.recommend_recycler)
    RecyclerView recommendRecycler;
    RecommendAdapter recommendAdapter;
    private List<RecommendBean> recommendBeansOne;
    private List<RecommendBannerBean> recommendBannerBeans;
    private List<MainVideoBean> mainVideoBeans;

    @Override
    protected int attachLayoutId() {
        return R.layout.fragment_video_recommend_fragement;
    }

    @Override
    protected MainVideoPresenter getPresenter() {
        return new MainVideoPresenter(this, new MainVideoModel());
    }

    @Override
    public void initView(View view) {
        recommendBeansOne = new ArrayList<>();
        recommendBannerBeans = new ArrayList<>();
        mainVideoBeans = new ArrayList<>();
        recommendRecycler.setLayoutManager(new LinearLayoutManager(mContext));
        initAddData();
        recommendAdapter = new RecommendAdapter(mainVideoBeans);
        recommendRecycler.setAdapter(recommendAdapter);

    }

    @Override
    public void initData() {

    }

    @Override
    public void setData(@Nullable Object data) {

    }

    private void initAddData() {
        //上面轮播图
        RecommendBannerBean recommendBannerBean = new RecommendBannerBean();
        RecommendListBean recommendListBean1;
        List<RecommendListBean> recommendListBeanList1 = new ArrayList<>();
        recommendListBean1 = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://yxqoss.oss-cn-hangzhou.aliyuncs.com/web/uploads/image/store_1/ffc4ce25ebdb0d8742fbff1034823217205e278c.png");
        recommendListBeanList1.add(recommendListBean1);
        recommendListBean1 = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://yxqoss.oss-cn-hangzhou.aliyuncs.com/web/uploads/image/store_1/ffc4ce25ebdb0d8742fbff1034823217205e278c.png");
        recommendListBeanList1.add(recommendListBean1);
        recommendListBean1 = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://yxqoss.oss-cn-hangzhou.aliyuncs.com/web/uploads/image/store_1/ffc4ce25ebdb0d8742fbff1034823217205e278c.png");
        recommendListBeanList1.add(recommendListBean1);
        recommendListBean1 = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://yxqoss.oss-cn-hangzhou.aliyuncs.com/web/uploads/image/store_1/ffc4ce25ebdb0d8742fbff1034823217205e278c.png");
        recommendListBeanList1.add(recommendListBean1);
        recommendBannerBean.setBannerListBean(recommendListBeanList1);
        recommendBannerBeans.add(recommendBannerBean);
        mainVideoBeans.addAll(recommendBannerBeans);
        //下面list图
        RecommendBean recommendBean = new RecommendBean();
        RecommendListBean recommendListBean;
        List<RecommendListBean> recommendListBeanList = new ArrayList<>();
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendListBean = new RecommendListBean("我是名称", "1000w", R.mipmap.head_icon, "成都", "http://img.zcool.cn/community/01847a59632279a8012193a30ca2b2.jpg@1280w_1l_2o_100sh.jpg");
        recommendListBeanList.add(recommendListBean);
        recommendBean.setRecommendBeans(recommendListBeanList);
        recommendBeansOne.add(recommendBean);
        mainVideoBeans.addAll(recommendBeansOne);
    }

    @Override
    public void onChannelListSuccess(List<ChannelListBean> channelListBeanList) {

    }

    @Override
    public void onChannelListFailed(String error) {

    }

    @Override
    public void onUserListSuccess(MLUserList userList) {

    }

    @Override
    public void onUserListFailed(String error) {

    }

    @Override
    public void onAdvertSuccess(AdvertBean advertBean) {

    }

    @Override
    public void onAdvertSuccessFailed(String error) {

    }
}
